﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WhiteBoard
{
    public partial class ScreenCut2 : Form
    {
        public ScreenCut2()
        {
            InitializeComponent();
        }

        private void ScreenCut2_Move(object sender, EventArgs e)
        {
            ScreenCut1 f = (ScreenCut1)this.Owner;
            f.btnCut.Location = this.Location;
        }

        private void ScreenCut2_SizeChanged(object sender, EventArgs e)
        {
            ScreenCut1 f = (ScreenCut1)this.Owner;
            f.btnCut.Size = this.Size;
        }

        private void ScreenCut2_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                this.Hide();
                ScreenCut1 f = (ScreenCut1)this.Owner;
                f.btnCut.Visible=false;
                f.btnSave.Visible = false;
            }
        }

        private void ScreenCut2_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ScreenCut1 f = new ScreenCut1();
            f = (ScreenCut1)this.Owner;
            Bitmap tmpBmp = new Bitmap(f.btnCut.Width, f.btnCut.Height);
            Graphics gr = Graphics.FromImage(tmpBmp);
            gr.CopyFromScreen(f.btnCut.Left, f.btnCut.Top, 0, 0, f.btnCut.Size);
            Clipboard.SetImage(tmpBmp);
            f.Close();
        }
    }
}
